/*  1:   */ package com.atomikos.util;
/*  2:   */ 
/*  3:   */ import java.util.HashMap;
/*  4:   */ import java.util.Map;
/*  5:   */ import javax.naming.NameAlreadyBoundException;
/*  6:   */ import javax.naming.NameNotFoundException;
/*  7:   */ 
/*  8:   */ public class IntraVmObjectRegistry
/*  9:   */ {
/* 10:43 */   private static final Map resourcesMap = new HashMap();
/* 11:   */   
/* 12:   */   public static synchronized void addResource(String resourceName, Object resource)
/* 13:   */     throws NameAlreadyBoundException
/* 14:   */   {
/* 15:47 */     if (resourcesMap.containsKey(resourceName)) {
/* 16:48 */       throw new NameAlreadyBoundException("resource with name '" + resourceName + "' already registered");
/* 17:   */     }
/* 18:50 */     resourcesMap.put(resourceName, resource);
/* 19:   */   }
/* 20:   */   
/* 21:   */   public static synchronized Object getResource(String resourceName)
/* 22:   */     throws NameNotFoundException
/* 23:   */   {
/* 24:55 */     if (!resourcesMap.containsKey(resourceName)) {
/* 25:56 */       throw new NameNotFoundException("no resource with name '" + resourceName + "' has been registered yet");
/* 26:   */     }
/* 27:58 */     return resourcesMap.get(resourceName);
/* 28:   */   }
/* 29:   */   
/* 30:   */   public static synchronized void removeResource(String resourceName)
/* 31:   */     throws NameNotFoundException
/* 32:   */   {
/* 33:63 */     if (!resourcesMap.containsKey(resourceName)) {
/* 34:64 */       throw new NameNotFoundException("no resource with name '" + resourceName + "' has been registered yet");
/* 35:   */     }
/* 36:66 */     resourcesMap.remove(resourceName);
/* 37:   */   }
/* 38:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\atomikos-util\3.7.0\atomikos-util-3.7.0.jar
 * Qualified Name:     com.atomikos.util.IntraVmObjectRegistry
 * JD-Core Version:    0.7.0.1
 */